package com.roncoo.pay.permission.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.roncoo.pay.common.core.page.PageBean;
import com.roncoo.pay.common.core.page.PageParam;
import com.roncoo.pay.permission.entity.PmsUserLog;
import com.roncoo.pay.permission.repository.PmsUserLogRepository;
import com.roncoo.pay.permission.service.PmsUserLogService;

/**
 * 操作员service接口实现
 *
 */
@Service("pmsOperatorLogService")
public class PmsUserLogServiceImpl implements PmsUserLogService {
	@Autowired
	private PmsUserLogRepository pmsUserLogRepository;

	/**
	 * 创建pmsOperator
	 */
	public void saveData(PmsUserLog pmsOperatorLog) {
		pmsUserLogRepository.save(pmsOperatorLog);
	}

	/**
	 * 修改pmsOperator
	 */
	public void updateData(PmsUserLog pmsOperatorLog) {
		pmsUserLogRepository.save(pmsOperatorLog);
	}

	/**
	 * 根据id获取数据pmsOperator
	 * 
	 * @param id
	 * @return
	 */
	public PmsUserLog getDataById(String id) {
		return pmsUserLogRepository.findOne(id);
	}

	/**
	 * 分页查询pmsOperator
	 * 
	 * @param pageParam
	 * @param ActivityVo
	 *            PmsOperator
	 * @return
	 */
	public PageBean<PmsUserLog> listPage(PageParam pageParam, PmsUserLog pmsUserLog) {
		Pageable pg = new PageRequest(pageParam.getPageNum(), pageParam.getNumPerPage());
		Example<PmsUserLog> example = Example.of(pmsUserLog);
		Page<PmsUserLog> page = pmsUserLogRepository.findAll(example, pg);
		PageBean<PmsUserLog> pb = new PageBean<PmsUserLog>(pageParam.getPageNum(), pageParam.getNumPerPage(), page.getTotalPages(),page.getContent());
		return pb;
	}
}
